<template>
	<view class="shopcart">
		<u-navbar :is-back="false" title="购物车" :title-bold="true">
			<view class="slot-wrap u-flex">
				<text class="editor" @click="editor">{{navText}}</text>
			</view>
		</u-navbar>
		<!-- 正文内容 -->
		<!-- 1111111111{{a}}22222222 -->
		<view class="shopcart-content">
			<view class="shopcart-list">
				<view class="shopcart-item" v-for="(item,index) in shopcartList" :key="index">
					<label class="radio">
						<radio value="" color="#FF3333"></radio>
						<text></text>
					</label>
					<image class="shopcart-img" :src="item.imgUrl" mode=""></image>
					<view class="shopcart-text">
						<view class="shopcart-name">{{item.name}}</view>
						<view class="shopcart-color">颜色：{{item.color}}</view>
						<view class="shopcart-price">
							<view>￥{{item.price}}</view>
							<view>x{{item.num}}</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 底部 -->
		<view class="footer">
			<label class="radio footer-radio">
				<radio value="" color="#FF3333" /><text>全选</text>
			</label>
			<view class="footer-total">
				<view class="footer-count">合计：<text class="number">￥0</text></view>
				<view class="footer-num">结算(0)</view>
			</view>
		</view>
	</view>
</template>

<script>
	import {mapState} from 'vuex'
	export default {
		data() {
			return {
				isNavBar: false,
				navText: '编辑',
				"shopcartList": [{
						"id": 1,
						"name": "舒绍淋读书要努力哦，不然以后就要搬砖挖煤了哟",
						"price": 13,
						"color": "颜色：棕色",
						"num": 5,
						"isChecked": false,
						"imgUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR2uEQv3pfxKVB2lmBlj78Ko-sbmwEtKGnBAA&usqp=CAU"
					},
					{
						"id": 2,
						"name": "黎雪娅读书要努力工作哦，不然以后就要去垃圾了哦",
						"price": 35,
						"color": "颜色：红色",
						"num": 10,
						"isChecked": false,
						"imgUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR2uEQv3pfxKVB2lmBlj78Ko-sbmwEtKGnBAA&usqp=CAU"
					},
					{
						"id": 3,
						"name": "黎雪娅读书要努力工作哦，不然以后就要去垃圾了哦",
						"price": 35,
						"color": "颜色：红色",
						"num": 10,
						"isChecked": false,
						"imgUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR2uEQv3pfxKVB2lmBlj78Ko-sbmwEtKGnBAA&usqp=CAU"
					},
					{
						"id": 4,
						"name": "黎雪娅读书要努力工作哦，不然以后就要去垃圾了哦",
						"price": 35,
						"color": "颜色：红色",
						"num": 10,
						"isChecked": false,
						"imgUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR2uEQv3pfxKVB2lmBlj78Ko-sbmwEtKGnBAA&usqp=CAU"
					},
					{
						"id": 5,
						"name": "黎雪娅读书要努力工作哦，不然以后就要去垃圾了哦",
						"price": 35,
						"color": "颜色：红色",
						"num": 10,
						"isChecked": false,
						"imgUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR2uEQv3pfxKVB2lmBlj78Ko-sbmwEtKGnBAA&usqp=CAU"
					},
					{
						"id": 6,
						"name": "黎雪娅读书要努力工作哦，不然以后就要去垃圾了哦",
						"price": 35,
						"color": "颜色：红色",
						"num": 10,
						"isChecked": false,
						"imgUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR2uEQv3pfxKVB2lmBlj78Ko-sbmwEtKGnBAA&usqp=CAU"
					},
					{
						"id": 7,
						"name": "黎雪娅读书要努力工作哦，不然以后就要去垃圾了哦",
						"price": 35,
						"color": "颜色：红色",
						"num": 10,
						"isChecked": false,
						"imgUrl": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR2uEQv3pfxKVB2lmBlj78Ko-sbmwEtKGnBAA&usqp=CAU"
					}
				]
			}
		},
		computed:{
			...mapState({
				a:state=>state.shopcart.a
			})
		},
		methods: {
			editor() {
				this.isNavBar = !this.isNavBar
				if (this.isNavBar == true) {
					this.navText = '完成'
				} else {
					this.navText = '编辑'
				}
			}
		}
	}
</script>
<style lang="scss" scoped>
	.slot-wrap {
		font-weight: bold;
		display: flex;
		align-items: center;
		padding-left: 670rpx;
		font-size: 26rpx;
	}

	.shopcart-content {
		.shopcart-list{
			padding-bottom: 100rpx;
		}
		.shopcart-item {
			display: flex;
			padding: 20rpx;
			align-items: center;
			justify-content: center;
			background-color: #F7F7F7;
			margin: 0 20rpx 20rpx 20rpx;
		}

		.shopcart-img {
			width: 180rpx;
			height: 180rpx;
			margin-left: 10rpx;
		}

		.shopcart-text {
			flex: 1;
			padding-left: 24rpx;

			.shopcart-color {
				font-size: 24rpx;
				color: #999999;
			}

			.shopcart-name {
				padding-bottom: 10rpx;
			}

			.shopcart-price {
				display: flex;
				padding-top: 10rpx;
				justify-content: space-between;
			}
		}
	}
	.footer{
		border-top: 2rpx solid #eeeeee;
		background-color: #fff;
		position: fixed;
		// bottom: 100rpx;
		bottom: 0;
		left: 0;
		width: 100%;
		height: 100rpx;
		display: flex;
		justify-content: space-between;
		align-items: center;
		.footer-radio{
			padding-left: 20rpx;
		}
		.footer-total{
			font-size: 34rpx;
			display: flex;
			.footer-count{
				line-height: 100rpx;
			}
			.number{
				color: #55aaff;
			}
			.footer-count{
				line-height: 100rpx;
				padding:0 20rpx ;
			}
			.footer-num{
				background-color: #55aaff;
				color: #fff;
				padding:0 60rpx;
				line-height: 100rpx;
			}
		}
	}
</style>
